import { log } from 'console'
import React, { Component } from 'react'
import { RouteComponentProps } from 'react-router-dom'
interface Iparam{
    myid:string
}
export default class Detail extends Component<RouteComponentProps<Iparam>> {
    state={
        pathname:''
    }
  componentDidMount(): void {
      console.log(this.props.match.params);
    //   this.setState({pathname:(this.props.location as any).pathname.substring(8)}) 一种断言解决不够准确
    this.setState({pathname:(this.props.match.params.myid)})  //最好是RouteComponentProps里再加相关接口 更加严格规范
  }
  render() {
    return (
      <div>详情页-
        {
            this.state.pathname
        }
        
      </div>
    )
  }
}
